<template>
	<view class="productHezuo">
		<view class="productHezuo-li" v-for="(item, index) of list" :key="index">
			<view class="productHezuo-li-left">
				<image class="productHezuo-li-left-img" @click="previewImage(item.attributeLogo)" :src=item.attributeLogo mode=""></image>
			</view>
			<view class="productHezuo-li-right">
				<view class="productHezuo-li-right-top font_blod">
					{{item.attributeName}}
				</view>
				<view class="productHezuo-li-right-cen">
					<text class="productHezuo-li-right-cen-txt" v-if="item.isPost == 1">包邮 偏远地区补差价</text>
					<text class="baoyou-no" v-else>不包邮</text>
				</view>
				<view class="productHezuo-li-right-btm">
					<view class="productHezuo-li-right-btm-li">
						合同价:
						<text class="productHezuo-li-right-btm-li-txt1 font_blod">￥</text>
						<text class="productHezuo-li-right-btm-li-txt2 font_blod">{{item.attributeContractPrice}}</text>
						/{{item.partsUnit}}
					</view>
					<view class="productHezuo-li-right-btm-li">
						售价:
						<text class="productHezuo-li-right-btm-li-txt1 font_blod color-1">￥</text>
						<text class="productHezuo-li-right-btm-li-txt2 font_blod color-1">{{item.attributeSalePrice}}</text>
						/{{item.partsUnit}}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import allapi from '../api/index.js'
	export default {
		data() {
			return {
				partsId: '',
				list: []
			}
		},
		onLoad(val) {
			this.partsId = val.id
		},
		mounted() {
			this.getFactoryPartsAttributeList()
		},
		methods: {
			// 图片预览
			previewImage(item, index){
				console.log(item);
				let lis = item.split()
				wx.previewImage({
				  current: 0, // 当前显示图片的http链接
				  urls: lis // 需要预览的图片http链接列表
				})
			},
			// 获取列表
			getFactoryPartsAttributeList () {
				uni.request({
					url: allapi.getFactoryPartsAttributeList,
					data: {
						factoryId: this.factoryId,
						partsId: this.partsId
					},
					success: (res) => {
						console.log(res);
						this.list = res.data.data
					}
				})
			}
		}
	}
</script>

<style scoped>
	.productHezuo-li {
		display: flex;
		padding: 24rpx;
		margin: 24rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
	}

	.productHezuo-li-left-img {
		width: 172rpx;
		height: 172rpx;
		border-radius: 8rpx;
		background: #EEEEEE;
	}

	.productHezuo-li-right {
		flex: 1;
		margin-left: 24rpx;
	}

	.productHezuo-li-right-top {
		font-size: 28rpx;
		color: #333333;
		line-height: 40rpx;
	}

	.productHezuo-li-right-cen {
		margin-top: 16rpx;
		height: 40rpx;
	}

	.productHezuo-li-right-cen-txt {
		padding: 0 12rpx;
		line-height: 34rpx;
		font-size: 24rpx;
		font-weight: 400;
		color: #28CD50;
		border-radius: 6rpx;
		border: 2rpx solid #28CD50;
	}

	.productHezuo-li-right-btm {
		display: flex;
		justify-content: space-between;
		margin-top: 26rpx;
		line-height: 40rpx;
	}

	.productHezuo-li-right-btm-li {
		font-size: 28rpx;
		font-weight: 400;
		color: #333333;
	}

	.productHezuo-li-right-btm-li-txt1 {
		font-size: 24rpx;
	}

	.productHezuo-li-right-btm-li-txt2 {
		font-size: 36rpx;
	}
	.color-1 {
		color: #EF691C;
	}
</style>
